package com.aspose.cells;

class zakp {
   private long b;
   private byte c;
   zkg a;

   zakp(boolean var1) {
      this.b(var1);
   }

   int a(WorksheetCollection var1, int var2, boolean[] var3) {
      var3[0] = true;
      switch(this.b()) {
      case 0:
         return var2;
      case 1:
         return this.d();
      case 2:
      default:
         int var4 = this.a(var1.n());
         zast var5 = var1.m();
         boolean var6 = false;

         int var7;
         int var8;
         for(var7 = 8; var7 <= 63; ++var7) {
            var8 = (Integer)var5.b().d((Object)var7);
            if (var4 == var8) {
               return var7;
            }
         }

         for(var7 = 0; var7 < 8; ++var7) {
            var8 = (Integer)var5.b().d((Object)var7);
            if (var4 == var8) {
               return var7;
            }
         }

         var3[0] = false;
         return var2;
      case 3:
         return this.d();
      }
   }

   int b(WorksheetCollection var1, int var2, boolean[] var3) {
      var3[0] = true;
      switch(this.b()) {
      case 0:
         return var2;
      case 1:
         return this.d();
      case 2:
      default:
         int var4 = this.a(var1.n());
         boolean var5 = false;
         zast var6 = var1.m();

         int var7;
         int var8;
         for(var7 = 8; var7 <= 63; ++var7) {
            var8 = (Integer)var6.b().d((Object)var7);
            if (var4 == var8) {
               return var7;
            }
         }

         for(var7 = 0; var7 < 8; ++var7) {
            var8 = (Integer)var6.b().d((Object)var7);
            if (var4 == var8) {
               return var7;
            }
         }

         var3[0] = false;
         return var6.c(var4);
      case 3:
         return this.d();
      }
   }

   boolean a() {
      return this.b() == 0 || this.b() == 1;
   }

   void a(boolean var1) {
      this.c = (byte)(this.c & 240);
      if (!var1) {
         this.c = (byte)(this.c | 1);
      }

   }

   int b() {
      switch(this.c & 255 & 15) {
      case 0:
         return 0;
      case 1:
         return 2;
      case 2:
         return 4;
      case 3:
         return 3;
      case 4:
         return 1;
      default:
         return 0;
      }
   }

   boolean c() {
      return (this.c & 255 & 16) != 0;
   }

   void b(boolean var1) {
      this.c = (byte)(this.c & 239);
      if (var1) {
         this.c = (byte)(this.c | 16);
      }

   }

   int d() {
      return (int)(this.b & 4294967295L & 16777215L);
   }

   int a(Workbook var1) {
      int var2 = (int)(this.b & 4294967295L & 16777215L);
      switch(this.c & 255 & 15) {
      case 0:
      case 4:
         return -1;
      default:
         var2 = this.c(var1);
         int var3 = var2 & 255;
         int var4 = (var2 & '\uff00') >> 8;
         int var5 = (var2 & 16711680) >> 16;
         return (var3 << 16) + (var4 << 8) + var5;
      }
   }

   Color b(Workbook var1) {
      switch(this.b()) {
      case 0:
      case 1:
         return Color.getEmpty();
      default:
         Color var2 = Color.getEmpty();
         int var3 = (int)(this.b & 4294967295L & 16777215L);
         switch(this.c & 255 & 15) {
         case 0:
         case 4:
            return Color.getEmpty();
         case 1:
            var2 = Color.fromArgb(var3);
            break;
         case 2:
            var2 = var1.c.a(var3);
            break;
         case 3:
            var2 = var1.getWorksheets().m().a(var3);
         }

         return this.a != null && this.a.getCount() != 0 ? this.a.a(var2, this.c()) : var2;
      }
   }

   int c(Workbook var1) {
      return this.b(var1).toArgb() & 16777215;
   }

   void e() {
      this.a = null;
   }

   void a(int var1, int var2) {
      this.c = (byte)(this.c & 240);
      this.b &= 4278190080L;
      switch(var1) {
      case 0:
         this.b |= (long)var2;
         break;
      case 1:
         this.b |= (long)var2;
         this.c = (byte)(this.c | 4);
         break;
      case 2:
         this.b |= (long)var2;
         this.c = (byte)(this.c | 1);
         break;
      case 3:
         this.b |= (long)var2;
         this.c = (byte)(this.c | 3);
         break;
      case 4:
         this.b |= (long)var2;
         this.c = (byte)(this.c | 2);
      }

   }

   boolean a(zakp var1) {
      if (this.a()) {
         return var1.a();
      } else if (var1.a()) {
         return false;
      } else if (this.b() != var1.b()) {
         return false;
      } else {
         return (this.b & 4294967295L & 16777215L) == (var1.b & 4294967295L & 16777215L) && this.b(var1);
      }
   }

   boolean a(zakp var1, Workbook var2, Workbook var3) {
      int var4 = this.b();
      int var5 = var1.b();
      switch(var4) {
      case 0:
      case 1:
         switch(var5) {
         case 0:
         case 1:
            return true;
         default:
            return false;
         }
      case 2:
         switch(var5) {
         case 0:
         case 1:
            return false;
         case 2:
            return (this.b & 4294967295L & 16777215L) == (var1.b & 4294967295L & 16777215L) && this.b(var1);
         case 3:
            return this.c(var2) == var1.c(var3);
         default:
            return false;
         }
      case 3:
         switch(var5) {
         case 0:
         case 1:
            return false;
         case 2:
            return this.c(var2) == var1.c(var3);
         case 3:
            if (var2 == var3) {
               return (this.b & 4294967295L & 16777215L) == (var1.b & 4294967295L & 16777215L);
            }

            return this.c(var2) == var1.c(var3);
         default:
            return false;
         }
      case 4:
         switch(var5) {
         case 0:
         case 1:
            return false;
         case 2:
         case 3:
         default:
            return false;
         case 4:
            return (this.b & 4294967295L & 16777215L) == (var1.b & 4294967295L & 16777215L) && this.b(var1);
         }
      default:
         return true;
      }
   }

   boolean b(zakp var1) {
      if (this.a != null && this.a.getCount() != 0) {
         return var1.a != null && var1.a.getCount() != 0 ? this.a.b(var1.a) : false;
      } else {
         return var1.a == null || var1.a.getCount() == 0;
      }
   }

   boolean a(Color var1, Color var2, Workbook var3) {
      if (!this.a()) {
         Color var4 = this.b(var3);
         if (com.aspose.cells.a.c.zh.a(var1)) {
            return (var4.toArgb() & 16777215) == (var2.toArgb() & 16777215);
         } else {
            return (var4.toArgb() & 16777215) == (var1.toArgb() & 16777215);
         }
      } else {
         return com.aspose.cells.a.c.zh.a(var1) || var1 == var2;
      }
   }

   boolean c(zakp var1) {
      if (this.a()) {
         return !var1.a();
      } else if (var1.a()) {
         return true;
      } else if (this.b() != var1.b()) {
         return true;
      } else {
         return (this.b & 4294967295L & 16777215L) != (var1.b & 4294967295L & 16777215L) || !this.b(var1);
      }
   }

   boolean b(zakp var1, Workbook var2, Workbook var3) {
      int var4 = this.b();
      int var5 = var1.b();
      switch(var4) {
      case 0:
      case 1:
         switch(var5) {
         case 0:
         case 1:
            return false;
         default:
            return true;
         }
      case 2:
         switch(var5) {
         case 0:
         case 1:
            return true;
         case 2:
            return (this.b & 4294967295L & 16777215L) != (var1.b & 4294967295L & 16777215L) || !this.b(var1);
         case 3:
            return this.c(var2) != var1.c(var3);
         default:
            return true;
         }
      case 3:
         switch(var5) {
         case 0:
         case 1:
            return true;
         case 2:
            return this.c(var2) != var1.c(var3);
         case 3:
            if (var2 == var3) {
               return (this.b & 4294967295L & 16777215L) != (var1.b & 4294967295L & 16777215L);
            }

            return this.c(var2) != var1.c(var3);
         default:
            return true;
         }
      case 4:
         switch(var5) {
         case 0:
         case 1:
            return true;
         case 2:
         case 3:
         default:
            return true;
         case 4:
            return (this.b & 4294967295L & 16777215L) != (var1.b & 4294967295L & 16777215L) || !this.b(var1);
         }
      default:
         return false;
      }
   }

   double f() {
      if (this.a == null) {
         return 0.0D;
      } else {
         return this.c() ? this.g() : (double)((float)this.j().c(0, 0) / 100000.0F);
      }
   }

   void a(double var1) {
      if (this.c()) {
         this.b(var1);
      } else {
         this.j().b(0, (int)(var1 * 100000.0D + 0.5D));
      }

   }

   double g() {
      zkg var1 = this.j();
      zkf var2;
      if (var1.getCount() == 1) {
         var2 = var1.a(0);
         if (var2.a == 21) {
            return (double)(var2.b - zml.k) * 1.0D / (double)zml.k;
         }
      } else if (var1.getCount() == 2) {
         var2 = null;
         zkf var3 = null;

         for(int var4 = 0; var4 < var1.getCount(); ++var4) {
            zkf var5 = var1.a(var4);
            if (var5.a == 21) {
               var2 = var5;
            } else if (var5.a == 22) {
               var3 = var5;
            }
         }

         if (var2 != null && var3 != null && var2.b + var3.b == zml.k) {
            return (double)(zml.k - var2.b) * 1.0D / (double)zml.k;
         }
      }

      return 0.0D;
   }

   void b(double var1) {
      this.b(true);
      zkg var3 = this.j();

      for(int var4 = 0; var4 < var3.getCount(); ++var4) {
         zkf var5 = var3.a(var4);
         if (var5.a == 23 || var5.a == 24 || var5.a == 21 || var5.a == 22 || var5.a == 1 || var5.a == 0) {
            var3.removeAt(var4--);
         }
      }

      if (var1 != 0.0D) {
         if (var1 > 0.0D) {
            var3.a(21, 100000 - (int)(var1 * 100000.0D));
            var3.a(22, (int)(var1 * 100000.0D));
         } else {
            var3.a(21, 100000 - (int)(Math.abs(var1) * 100000.0D));
         }
      }

   }

   static double d(zakp var0) {
      if (var0 == null) {
         return 0.0D;
      } else {
         double var1 = (double)var0.h();
         return com.aspose.cells.b.a.zq.b(((double)zml.k - var1) / (double)zml.k, 2);
      }
   }

   static zakp a(zakp var0, double var1) {
      zakp var3 = var0;
      if (var0 == null) {
         var3 = new zakp(true);
      }

      if (var1 >= 0.0D && var1 <= 1.0D) {
         double var4 = 1.0D - var1;
         var3.a((int)(var4 * (double)zml.k + 0.5D));
         return var3;
      } else {
         throw new CellsException(6, "Transparency must between 0.0 (opaque) and 1.0 (clear)");
      }
   }

   static int e(zakp var0) {
      return var0 == null ? 100 : var0.h() / 1000;
   }

   static zakp a(zakp var0, int var1) {
      zakp var2 = var0;
      if (var0 == null) {
         var2 = new zakp(true);
      }

      var2.a(var1 * 1000);
      return var2;
   }

   int h() {
      return this.a == null ? zml.k : this.a.c(2, zml.k);
   }

   void a(int var1) {
      this.j().b(2, var1);
   }

   boolean b(int var1) {
      if (this.j() == null) {
         return false;
      } else {
         for(int var2 = 0; var2 < this.j().getCount(); ++var2) {
            if (this.j().a(var2).a == var1) {
               return true;
            }
         }

         return false;
      }
   }

   zkg i() {
      return this.a;
   }

   zkg j() {
      if (this.a == null) {
         this.a = new zkg();
      }

      return this.a;
   }

   void a(zakp var1, CopyOptions var2) {
      boolean var3 = var2 == null || var2.l == var2.m;
      if (var1.b() == 3 && !var3) {
         this.a(2, var1.c(var2.l));
      } else {
         this.b = var1.b;
         this.c = var1.c;
      }

      if (var1.a != null) {
         this.a = new zkg();
         this.a.a(var1.a);
      } else {
         this.a = null;
      }

   }

   void f(zakp var1) {
      this.b = var1.b;
      this.c = var1.c;
      if (var1.a != null) {
         this.a = new zkg();
         this.a.a(var1.a);
      } else {
         this.a = null;
      }

   }

   static boolean a(zakp var0, zakp var1, zma var2) {
      if (var0 != null) {
         return var1 == null ? false : var0.g(var1);
      } else {
         return var1 == null;
      }
   }

   boolean g(zakp var1) {
      if (this.b != var1.b) {
         return false;
      } else if (this.c != var1.c) {
         return false;
      } else {
         if (this.a != null || var1.a != null) {
            if (this.a == null || var1.a == null) {
               return false;
            }

            if (!this.a.b(var1.a)) {
               return false;
            }
         }

         return true;
      }
   }
}
